package com.organization

class Employee {

    //main info
	String firstName
    String lastName

    //summary info
    String workPosition
    Date hireDate

    //contacts
    String extensionPhone
    String homePhone
    String mobilePhone
    String email

    //address
    String addressStreetCity
    String addressHouse
    String addressApartment

    //passport data
    String gender
    Date birthDate
	
	static belongsTo = [project:Project]

    static constraints = {
		firstName(blank:false,size:2..255)
        lastName(blank:false,size:2..255)
        workPosition(nullable:true)
        hireDate(nullable:true)
        extensionPhone(nullable:true,matches:'[0-9]{4,}')
        homePhone(nullable:true,matches:'[0-9]{4,}')
        mobilePhone(nullable:true,matches:'^[/+]{0,1}[0-9]{11}$')
        email(nullable:true,email:true)
        addressStreetCity(nullable:true,size:1..32)
        addressHouse(nullable:true)
        addressApartment(nullable:true)
        birthDate(nullable:true)
        gender(nullable:true,inList:['M','F'])
    }
	
	String toString(){
		return lastName+" "+firstName;
	}
}
